{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var  
    s,t:string;  
    i,j:integer;  
    len:integer;  
    x,max,l:longint;  
begin  
    readln(s);  
    len:=length(s);  
    max:=-1;  
    for i:=1 to len do  
    for j:=1 to len-i+1 do  
    begin  
        t:=copy(s,i,j);  
        val(t,x,l);  
        if(l=0)then  
            if(x>max)then  
                max:=x;  
    end;  
    str(max,t);  
    writeln(pos(t,s));  
end.  